<template>
	<view class="container">
		<view class="intro">学习测试</view>
		<text class="intro">详见：</text>
		<uni-link :href="href" :text="href"></uni-link>
		<view>{{num}}</view>
		<u-switch v-model="checked" @change = "change(checked)"></u-switch>
		<view><u-number-box v-model="value" @change="valChange"></u-number-box></view>
		<view>
			<u-popup v-model="show" mode='bottom'>
				<view class="test">测试测试测试</view>
			</u-popup>
			<u-button @click="show = true">打开</u-button>
		</view>
		<ol>
		    <li v-for="cleana in clean">
		      {{ cleana.address }}
		    </li>
		</ol>
	</view>
</template>

<script>
	import {request} from '../../request/request.js'
	export default {
		data() {
			return {
				href: 'https://uniapp.dcloud.io/component/README?id=uniui',
				num: 111,
				checked: false,
				value: 0,
				show: false,
				flag: 0,
				clean: []
			}
		},
		
		onLoad() {
			// this.getMachineNum();
			this.getJsSdk();
			// uni.request({
			//     url: 'https://dev.hyzszy.com.cn/web/manager/index', //仅为示例，并非真实接口地址。
			//     data: {
			//         do: 'cleanCompanyList',
			// 		debug: 'cross'
			//     },
			//     header: {
			//         'Content-type': 'application/x-www-form-urlencoded',
			//     },
			//     success: (res) => {
			// 		console.log(res.data.data.data)
			//         this.clean = res.data.data.data;
			//     }
			// });
		},
		methods: {
			// switch打开或者关闭时触发，值为true或者false
			// 即使不监听此事件，this.checked此时也会相应的变成true或者false
			change(status) {
				if (status == true) {
					this.flag = 1;
				} else {
					this.flag = 0;
				}
				console.log(this.flag);
			},
			valChange(e) {
				console.log('当前值为: ' + e.value)
			},
			
			getMachineNum:function(){
			    this.sendRequest({
			        url : "web/manager/index",
					data: {
						do: 'cleanCompanyList',
						debug: 'cross'
					}
			    },'../myhome/myhome','2').then(res=>{
					this.clean = res.data.data
				})
			},
			
			getJsSdk:function(){
				this.http.get('/web/manager/index?', {
					params: {
						do: 'cleanCompanyList',
						debug: 'cross'
					}
				}).then(res=> {
					this.clean = res.data.data
				}).catch(err=> {
					
				})
			}

		}
	}
</script>

<style>
	.container {
		padding: 20px;
		font-size: 14px;
		line-height: 24px;
	}
	
	.test {
		height: 500rpx;
	}
</style>
